package com.triones.api.controller.web;


import com.ruoyi.common.core.domain.R;
import com.triones.api.service.FinanceService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 财务账单管理
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/system/finance")
public class FinanceController {

    private final FinanceService financeService;

    /**
     * 累计入金统计
     * @return
     */
    @GetMapping(value = "/crypto/depositTotal/sta")
    public R<Map> cryptoDepositTotalSta() {
        return R.ok(financeService.cryptoDepositTotalSta());
    }

    /**
     * crypto 池统计
     * @return
     */
    @GetMapping(value = "/crypto/poolTotal/sta")
    public R<Map> cryptoPoolTotalSta() {
        return R.ok(financeService.cryptoPoolTotalSta());
    }

    /**
     * 累计出金统计
     * @return
     */
    @GetMapping(value = "/crypto/withdrawTotal/sta")
    public R<Map> cryptoWithdrawTotalSta() {
        return R.ok(financeService.cryptoWithdrawTotalSta());
    }

    /**
     * 用户累计出金利润统计
     * @return
     */
    @GetMapping(value = "/crypto/memberWithdrawProfit/sta/{scene}")
    public R<Map> cryptoMemberWithdrawProfitSta(@PathVariable String scene) {
        return R.ok(financeService.cryptoMemberWithdrawProfitSta(scene));
    }

    /**
     * 系统累计出金利润统计
     * @return
     */
    @GetMapping(value = "/crypto/systemWithdrawProfit/sta/{scene}")
    public R<Map> cryptoSystemWithdrawProfitSta(@PathVariable String scene) {
        return R.ok(financeService.cryptoSystemWithdrawProfitSta(scene));
    }

    /**
     * 入金占比统计（饼图）
     * @return
     */
    @GetMapping(value = "/crypto/depositTotalByChainAndYear/sta")
    public R<Map> cryptoDepositTotalByChainAndYearSta(String chain, String year) {
        return R.ok(financeService.cryptoDepositTotalByChainAndYearSta(chain, year));
    }
}
